//引入pina
import { createPinia, defineStore } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

const pinia = createPinia() //定义大的储物柜
pinia.use(piniaPluginPersistedstate) //储物柜使用持久化插件

export default pinia

//定义一个小柜子
const wmsStore = defineStore('wms-store', {
    state: () => {
        return {
            nickName: "游客",
            id: 0,
            token: "",
            roles: [],
            Permissions: [],
            poItems:[],
            outItems:[],
        }
    },
    persist: {
        key: 'wms-store',
        storage: localStorage,
    },
})

export { wmsStore }